package com.album.task;



import android.content.Context;

import com.album.http.HttpRequest;
import com.album.utils.Config;
import com.album.utils.MyLog;
/**
 * 用户登录
 * @author Rome
 *
 */
public class UserLoginTask  extends Task{
	private String TAG = "UserLoginTask";
	private Context ctx;
	private ICallBack callBack;
	private String imsi; //133001330000
	private String username;//18926128667@189.cn
	private String password;
	
	public UserLoginTask(Context ctx,String imsi,String username,String password,ICallBack resTask){
		this.ctx = ctx;
		this.callBack = resTask;
		this.imsi = imsi;
		this.username = username;
		this.password = password;
	}
	public String setRequest(){
		String strUrl =Config.TyHttp 
		+Config.TyUserHttp
		+"login?imsi="+imsi
		+"&passport="+username
		+"&passsword="+password;
        MyLog.info(UserLoginTask.class,strUrl);
        String jsonRsp = HttpRequest.sendDataPost(ctx,strUrl, null,callBack);
		return jsonRsp;
	}
	@Override
	public void doTask(Task thread){
		Thread t = new Thread(thread);
		t.start();
	}
	@Override
	public void run() {
		//返回数据
		try {
			String strRsp = setRequest();
			callBack.CallBack(strRsp);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}

